package grpcserver

import (
	v1etcd "gitee.com/scottq/go-framework/src/v1/libs/clients/etcd"
)

type EtcdRegisterFinder struct {
	etcdAddr string
}

func NewEtcdSrvRegister(etcdAddr string, ) (IServiceRegister, error) {
	return &EtcdRegisterFinder{
		etcdAddr: etcdAddr,
	}, nil
}

func (r *EtcdRegisterFinder) Register(name string, addr string) error {
	sr := v1etcd.RegisterService(
		r.etcdAddr,
		name,
		addr, 5)
	go sr.ListenLease()
	return nil
}
